<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<% String path = request.getContextPath();%>     

<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />

<link href="<%=path%>/static/managecss/h-ui/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/static/managecss/h-ui.admin/css/H-ui.login.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/static/managecss/h-ui.admin/css/style.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/static/managecss/lib/Hui-iconfont/1.0.8/iconfont.css" rel="stylesheet" type="text/css" />

<title>后台登录 - Recycle.admin v1.0</title>
<meta name="keywords" content="">
<meta name="description" content="">

<!-- 登录按钮样式 -->
<style type="text/css">
	#submit{
		width:250px;
		height:40px;
		background-color:#66CCFF;
		text-align:center;
		font-size:25px;
		border-radius:10px;
		color:gray;
	}
	#submit:hover{
		color:white;
		cursor:pointer;
	}
</style>

</head>
<body>
<input type="hidden" id="TenantId" name="TenantId" value="" />
<div class="header"></div>
<div class="loginWraper">
  <div id="loginform" class="loginBox">
  <c:if test="${param.mes==\"error\" }"><div style="color:red;margin-left:160px;">用户名或密码错误</div></c:if>
    <form id="form" class="form form-horizontal" action="<%=path %>/manager/loginSubmit" method="post">
      <div class="row cl">
        <label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60d;</i></label>
        <div class="formControls col-xs-8">
          <input id="name" name="name" type="text" placeholder="用户名" class="input-text size-L" style="width:300px;border-radius:10px;">
        </div>
      </div>
      <div class="row cl">
        <label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60e;</i></label>
        <div class="formControls col-xs-8">
          <input id="password" name="password" type="password" placeholder="密码" class="input-text size-L" style="width:300px;border-radius:10px;">
        </div>
      </div>
      <div class="row cl">
        <div class="formControls col-xs-8 col-xs-offset-3">
          <input id="checkCode" class="input-text size-L" type="text" placeholder="验证码" style="width:150px;border-radius:10px;">
          <a id="changeCode" href="javascript:;"><img id="code" src="<%=path%>/manager/checkCode" style="width:100px;height:40px;border-radius:10px;"> 换一张</a> </div>
      </div>
      <div style="margin-top:50px;" class="row cl">
        <div class="formControls col-xs-8 col-xs-offset-3">
          <div id="submit">登<c:forEach begin="0" end="6">&nbsp;</c:forEach>录</div>
        </div>
      </div>
    </form>
    
  </div>
</div>
<div class="footer">万码学堂</div>
<script type="text/javascript" src="<%=path%>/static/managecss/lib/jquery/1.9.1/jquery.min.js"></script> 
<!--此乃百度统计代码，请自行删除-->
<script>
$(function(){
	var code = false;
	
	/*点击更换验证码*/
	$("#changeCode").click(function(){
		$("#code").attr("src","<%=path%>/manager/checkCode?rand="+Math.random());
	})
	
	//判断验证码是否正确
	$("#checkCode").blur(function(){
		var checkCode = $(this).val();
		if(checkCode==""){
			alert("请输入验证码");
		}else{
			$.post("<%=path%>/manager/checkCodeIsTrue",
					{checkCode:checkCode},
					function(flag){
						if(flag=="isTrue"){
							code = true;
						}else{
							alert("验证码不正确");
							$("#code").attr("src","<%=path%>/manager/checkCode?rand="+Math.random());
						}
					});
		}
	});
	
	/*点击登录*/
	$("#submit").click(function(){
		var name = $("#name").val();
		var password = $("#password").val();
		if(name!=""&&password!=""&&code==true){
			$("#form").submit();
		}else{
			alert("用户名或密码不能为空");
		}
		
	});
	
	
	
	
	
	
	
});

</script>
